
import 'package:flutter/material.dart';
import 'package:tree_hole/letters/AllDiaries.dart';

import 'LetterPaperPage.dart';

//我的日记界面
class MyDiary extends StatefulWidget {

  String token;

  MyDiary(this.token);
  @override
  _MyDiary createState() => new _MyDiary();
}

class _MyDiary extends State<MyDiary> {

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: new AppBar(
        title: new Text('我的日记',style:TextStyle(color: Colors.black)),
        backgroundColor: Colors.white70,
        leading: IconButton(
          icon:Icon(Icons.arrow_back,color: Colors.black),
          onPressed: () {Navigator.pop(context);},
        ),
      ),
      body: Container(
        decoration: BoxDecoration(
            image: DecorationImage(
                fit: BoxFit.cover,
                image: AssetImage('images/paperpage1.jpg')//获取信纸
            )
        ),
        child:  Center(
            child: Column(
              children: [
                Expanded(
                  flex: 5,
                  child: SizedBox(),),
                Expanded(
                    flex: 2,
                    child: Container(
                        width: 280,
                        child:FlatButton(
                          child: Text("我的日记本",style: TextStyle(fontSize: 16,color: Colors.black),),
                          color: Colors.greenAccent[100],
                          shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(10)
                          ),
                          onPressed: (){
                            Navigator.push(context, MaterialPageRoute(builder: (context) {
                              return AllDiaries(widget.token);
                            }));
                          },
                        ))),
                Expanded(
                  flex: 1,
                  child: SizedBox(),),
                Expanded(
                    flex: 2,
                    child: Container(
                        width: 280,
                        child:FlatButton(
                          child: Text("写日记",style: TextStyle(fontSize: 16,color: Colors.black),),
                          color: Colors.greenAccent[100],
                          shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(10)
                          ),
                          onPressed: (){
                            Navigator.push(context, MaterialPageRoute(builder: (context) {
                              return LetterPaperPage(widget.token);
                            }));
                          },
                        ))),
                Expanded(
                  flex: 5,
                  child: SizedBox(),),
              ],
            )
        ),
      ),

    );
  }



}